<?php

namespace App\Services\Account;

use App\Models\VipPurchase;
use Illuminate\Database\Eloquent\Relations\HasMany;

class AccountGoldCoins extends AccountAbstract
{
    protected function account(): HasMany
    {
        return $this->user->goldCoins();
    }

    public function plusEachGoldCharge($coins, $data = [])
	{
		$money = big_decimal($coins);
		$this->record($money, 'gold_charge', '账户充值', $data);
	}

	public function plusTransferedCoins($coins, $data = [])
	{
		$coins = big_decimal($coins);
		$this->record($coins, 'transfered_in_coins', '账户转入', $data);
	}

	public function plusSupportedCoins($coins, $data = [])
	{
		$coins = big_decimal($coins);
		$this->record($coins, 'support_gold_coins', '平台扶持余额', $data);
	}

	public function plusResellingCoins($coins, $data = [])
	{
		$coins = big_decimal($coins);
		$this->record($coins, 'resold_cost_coins', '寄售本金回款', $data);
	}

	public function plusResellingBeansCoins($coins, $data = [])
	{
		$coins = big_decimal($coins);
		$this->record($coins, 'resold_beans_coins', '寄售金豆变现', $data);
	}

	public function plusResellingProfitCoins($coins, $data = [])
	{
		$coins = big_decimal($coins);
		$this->record($coins, 'resold_profit_coins', '寄售利润', $data);
	}

	public function plusSplitCoins($coins, $data = [])
	{
		$coins = big_decimal($coins);
		$this->record($coins, 'split_return_coins', '超额返订单收入', $data);
	}

	public function plusGoldRecordDirectPrize($coins, $data = [])
	{
        $coins = big_decimal($coins);
		$this->record($coins, 'gold_record_direct_prize', '推荐奖励', $data);
	}

	public function plusGoldRecordTeamPrize($coins, $data = [])
	{
        $coins = big_decimal($coins);
		$this->record($coins, 'gold_record_team_prize', '炼金师奖励', $data);
	}

    public function plusUnlockedSubsidise($coins, $data = [])
    {
        $coins = big_decimal($coins);
        $this->record($coins, 'unlocked_gold_subsidies', '解锁补贴金', $data);
    }

	public function plusOrderRefund($coins, $data = [])
	{
        $coins = big_decimal($coins);
		$this->record($coins, 'order_refund', '商品订单退款', $data);
	}

	public function plusRefusedWithdrawPrincipal($coins, $data = [])
	{
        $coins = big_decimal($coins);
		$this->record($coins, 'withdraw_refusal_principal', '提现驳回返还本金', $data);
	}

	public function plusRefusedWithdrawCharge($coins, $data = [])
	{
        $coins = big_decimal($coins);
		$this->record($coins, 'withdraw_refusal_charge', '提现驳回返还手续费', $data);
	}

	public function plusFailedWithdrawPrincipal($coins, $data = [])
	{
        $coins = big_decimal($coins);
		$this->record($coins, 'withdraw_failed_principal', '提现失败返还本金', $data);
	}

	public function plusFailedWithdrawCharge($coins, $data = [])
	{
        $coins = big_decimal($coins);
		$this->record($coins, 'withdraw_failed_charge', '提现失败返还手续费', $data);
	}

	public function plusExceptionCoinsRefund($coins, $data = [])
	{
        $coins = big_decimal($coins);
		$this->record($coins, 'exception_coins_refund', '系统异常扣款回退', $data);
	}

	public function plusExtraGoldCoins($coins, $data = [])
	{
        $coins = big_decimal($coins);
		$this->record($coins, 'extra_gold_coins_return', '抢购异常付款回退', $data);
	}

	public function plusSystemTransferCoins($coins, $data = [])
	{
        $coins = big_decimal($coins);
		$this->record($coins, 'system_transfer_coins', '系统转账', $data);
	}

	/*---------- minus -------------------------------------------------------------------------------------------------*/

	public function minusTransferedCoins($coins, $data = [])
	{
		$coins = big_decimal($coins)->multipliedBy(-1);
		$this->record($coins, 'transfered_out_coins', '账户转出', $data);
	}

	public function minusStormPaid($coins, $data = [])
	{
		$money = big_decimal($coins)->multipliedBy(-1);
		$this->record($money, 'pay_gold_record', '黄金风爆订单支出', $data);
	}

	public function minusOrderPaid($coins, $data = [])
	{
		$money = big_decimal($coins)->multipliedBy(-1);
		$this->record($money, 'pay_order', '商品订单支出', $data);
	}

	public function minusWithdrawPrincipal($money, $data = [])
	{
		$money = big_decimal($money)->multipliedBy(-1);
		$this->record($money, 'withdraw_principal', '提现', $data);
	}

	public function minusWithdrawCharge($money, $data = [])
	{
		$money = big_decimal($money)->multipliedBy(-1);
		$this->record($money, 'withdraw_charge', '提现手续费', $data);
	}

	public function minusSystemRecall($money, $data = [])
	{
		$money = big_decimal($money)->multipliedBy(-1);
		$this->record($money, 'system_recall', '系统回收', $data);
	}

	public function minusWithdrawExceptional($money, $data = [])
	{
		$money = big_decimal($money)->multipliedBy(-1);
		$this->record($money, 'withdraw_exceptional_return', '系统提现异常超支回收', $data);
	}

	public function minusAccountExceptional($money, $data = [])
	{
		$money = big_decimal($money)->multipliedBy(-1);
		$this->record($money, 'account_exceptional_return', '系统资金异常超支回收', $data);
	}

	public function minusExceptionGoldCoin($money, $data = [])
	{
		$money = big_decimal($money)->multipliedBy(-1);
		$this->record($money, 'exception_gold_coins_return', '抢购异常回收', $data);
	}
}
